#ifndef __BUTTON_HANDLER_H__
#define __BUTTON_HANDLER_H__

#include "application.h"
#include "button.h"

enum class ButtonRole {
    Boot,
    VolumeUp,
    VolumeDown,
    Count  // 用于记录总数
};

class ButtonHandler {
   public:
    static ButtonHandler& GetInstance() {
        static ButtonHandler instance;
        return instance;
    }
    // 删除拷贝构造函数和赋值运算符
    ButtonHandler(const ButtonHandler&) = delete;
    ButtonHandler& operator=(const ButtonHandler&) = delete;

    void Init();
    void Deinit();

   private:
    ButtonHandler();
    ~ButtonHandler();

    void RegisterCallbacks(ButtonRole role, Button* button);

    int button_count_ = 0;
    Button** buttons_ = nullptr;
};

#endif